$(document).ready(function(){
	GoToLogin();
	KeyBoardClick();
});
//捕捉键盘点击事件
var KeyBoardClick = function(){
	/*获得键盘上对应的 ascII 码*/
	/*$(document).keydown(function (event) {
	    alert(event.keyCode);
	});*/
	$(document).keydown(function (event) {
	    
	    switch (event.keyCode) {
	    case 13:
	    	$("div.submit").click();//键盘点击Enter键提交登录
	        break;
	    
	    };
//	    return false;//阻止键盘上任何按键操作
	});
	layer.close(LoadingIcon);
}
var GoToLogin = function(){
	$("div.register_info").click(function(){
		var url = basePath+"/loginstepone?loginstepflag=5";
		url = encodeURI(url);
		url = encodeURI(url);
		window.location.href = (url);
	});
};
var SendPhoneCode = function(){
	var phone=$("#phone").val();
    if(phone == ""){
    	layer.msg("请填写正确的手机号码");
    	return;
    }
    $.ajax({
        url:basePath+'/meb/phonecode',
        data:{
            phone:phone
        },
        type:'post',
        dataType:'json',
        success:function(data){
        	if(data.code == "1"){
        		layer.msg("手机验证码发送成功，请注意查收");
                var count = 60;
                var interval = setInterval(function(){
                	count -= 1;
                	var detail = count + "s后可重发"
                	$("input.sendpcode").val(detail);
                	$("input.sendpcode").attr("disabled",true);
                	if(count === 0){
                		$("input.sendpcode").val("发送验证码");
                		$("input.sendpcode").attr("disabled",false);
                		clearInterval(interval);
                	};  	
                },1000);
        	}else{
        		layer.msg("发送失败，请检查手机号码是否有误");
        	}
        	
        },
        error:function(data){
        	layer.msg("验证码发送失败，请检查手机号码是否有误");
        },
        complete:function (data) {
			
        }
    })
}